﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace ZX.WebApp.Extend
{
    public partial class hrEmpGetPhoto : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string connString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnString"].ToString();
            //打开数据库
            using (SqlConnection conn = new SqlConnection(connString))
            {
                conn.Open();
                SqlCommand com = new SqlCommand("select * from hrEmployeeFileStreams where Precordid =@Precordid and Datstate = 0", conn);
                com.Parameters.Add("Precordid", SqlDbType.UniqueIdentifier);
                com.Parameters["Precordid"].Value = Guid.Parse(Request.QueryString["id"].ToString());    //外键,员工

                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    Response.OutputStream.Write(dr["FileData"] as byte[], 0, (dr["FileData"] as byte[]).Length);
                    Response.End();
                }
                dr.Close();
                com.Clone();
            }
        }
    }
}